<template>
  <div>
    <h1>新建装备</h1>
    <el-form label-width="80px" @submit.native.prevent="save">
      <el-form-item label="名称">
        <el-input v-model="formInfo.name"></el-input>
      </el-form-item>
      <el-form-item label="图标">
        <el-upload
          class="avatar-uploader"
          :action="imgUploadUrl"
          :show-file-list="false"
          :on-success="handleImgSuccess"
        >
          <img v-if="formInfo.icon" :src="formInfo.icon" class="avatar" />
          <i v-else class="el-icon-plus avatar-uploader-icon"></i>
        </el-upload>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" native-type="submit">创建</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { EQUIP } from '@/utils/const'
import { commonMixin } from '@/utils/mixin'

export default {
  mixins: [commonMixin],
  methods: {
    save () {
      this.add(EQUIP)
    },
  },
}
</script>

<style scoped>
</style>